package com.example.myapplication.fregments;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.example.myapplication.R;

public class BlankFragment extends Fragment {

    private View root;
    private TextView textView;
    private Button btn;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (root == null)
            root = inflater.inflate(R.layout.fragment_blank, container, false);

        Bundle arguments = getArguments();
//        String message = arguments.getString("message");

        textView = root.findViewById(R.id.textview_fragment);
        btn = root.findViewById(R.id.btn_fragment);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                textView.setText("就是我咋滴");
            }
        });

        return root;
    }
}